After updating to CRA 5.0.0, I got this error on compilation process:
ERROR in Plugin "react" was conflicted between ".eslintrc.json" and "BaseConfig » "..\react-app\node_modules\eslint-config-react-app\base.js".
My eslint configuration is:
{
"env": {
"browser": true,
"es2021": true
},
"extends": [
"plugin:react/recommended",
"airbnb",
"plugin:react/jsx-runtime"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react",
"@typescript-eslint"
],
"rules": {...}
}
Any solutions/fixes?
Well, this seems to be related to one of the following issues.
https://github.com/yannickcr/eslint-plugin-react/issues/3128
https://github.com/facebook/create-react-app/issues/10463
What you can try is the following (if the first one does not work, try the second one, if you are using yarn):
pnpFallbackMode: all to .yarnrc.yml file, if you are using yarn, as explained here https://github.com/facebook/create-react-app/issues/10463#issuecomment-997378138In addition, take a look the CRA release notes to check if some action is required, especially the part about "Migrating from 4.0.x to 5.0.0", you may need to update react-scripts as well.
https://github.com/facebook/create-react-app/releases/tag/v5.0.0
I think it's because of not an updated eslint. Just changing the eslint version to 8.0.0 from 7.0.0 in your package.json worked for me or you update in your cli using npm.
I just tried to use your config in my project (which is working with CRA 5.0.0) and didn't receive this error. I think the problem is that you didn't update one or several eslint-related packages. You can try to update them:
yarn add -D \
eslint@^8.6.0 \
@typescript-eslint/eslint-plugin@^5.9.0 \
@typescript-eslint/parser@^5.9.0 \
eslint-plugin-react@^7.28.0 \
eslint-config-react@^1.1.7 \
eslint-config-airbnb@^19.0.4
or npm install instead of yarn add if you are using npm